class RoomListWindowView extends how.module.Window
{
	public roomList: eui.List; //游戏房间列表
    public btnRoomPanelBack: eui.Button; // 游戏房间面板关闭按钮
	    // 房卡房
	public tabBarCardRoom: eui.TabBar;
	public vstackCardRoom: eui.ViewStack;
    public cardroomPanel: eui.Panel;
    public rc_config1: eui.RadioButton;
    public rc_config2: eui.RadioButton;
    public rc_roomID: eui.EditableText;
    public rc_createRoom: eui.Button;
    public rc_joinRoom: eui.Button;

	public constructor() 
	{
		super();
		this.skinName = "RoomListWindowSkin";
		this.init();
	}

	public static AllowReportChildren: Array<any> = ["roomListItem"];
	private init(): void
	{
		this.tabBarCardRoom.addEventListener(egret.Event.CHANGE, this.onTarBarCardRoomChange, this);
		this.btnRoomPanelBack.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onCloseButton, this);
		this.rc_createRoom.addEventListener(egret.TouchEvent.TOUCH_TAP, this.btnRCCreate, this);
        this.rc_joinRoom.addEventListener(egret.TouchEvent.TOUCH_TAP, this.btnRCJoin, this);
	}

	private updateData(roomCollection: eui.ArrayCollection): void
	{
		this.roomList.dataProvider = roomCollection;
	}


	private showCardRoomPanel(isShow = true):void
    {
        this.cardroomPanel.visible = isShow;
    }

	 private btnRCCreate(): void
    {
        this.report(RoomListWindowModule.request.onRCRoomCreate);
    }

    private btnRCJoin(): void
    {
        this.report(RoomListWindowModule.request.onRCRoomJoin,  this.rc_roomID.text);
    }

	private onTarBarCardRoomChange(): void
	{
		this.vstackCardRoom.selectedIndex = this.tabBarCardRoom.selectedIndex;
	}


	/*
	*按下关闭按钮
	* */
	protected onCloseButton(): void 
	{
		this.roomList.dataProvider = null;
		this.close();
	}
}

window["RoomListWindowView"] || (window["RoomListWindowView"] = RoomListWindowView);
